#include <bits/stdc++.h>
using namespace std;
#define For(Ti,Ta,Tb) for(int Ti=(Ta);Ti<=(Tb);++Ti)
#define Dec(Ti,Ta,Tb) for(int Ti=(Ta);Ti>=(Tb);--Ti)
#define Debug(...) fprintf(stderr,__VA_ARGS__)
using ll=long long;
mt19937 eng(chrono::system_clock::now().time_since_epoch().count());
template<typename T> T Rand(const T &_l,const T &_r){return uniform_int_distribution<T>(_l,_r)(eng);}
vector<pair<ll,int>> PrimeFac(ll _x){
vector<pair<ll,int>> _res;
auto _add=[&](int _i){
if(_x%_i==0){
_res.emplace_back(_i,0);
while(_x%_i==0) ++_res.back().second,_x/=_i;
}
};
_add(2),_add(3);
for(int _i=5;1LL*_i*_i<=_x;_i+=6) _add(_i),_add(_i+2);
if(_x>1) _res.emplace_back(_x,1);
return _res;
}
vector<ll> Divisors(ll _x){
vector<ll> _res;
for(int _i=1;1LL*_i*_i<=_x;++_i) if(_x%_i==0){
_res.push_back(_i);
if(1LL*_i*_i!=_x) _res.push_back(_x/_i);
}
return _res;
}
const int N=1e6+5;
int n;ll a[N];
int main(){
ios::sync_with_stdio(false),cin.tie(nullptr);
cin>>n;
For(i,1,n) cin>>a[i];
ll ans=1;
For(_,1,12){
int i=Rand(1,n);
auto pf=PrimeFac(a[i]);
auto div=Divisors(a[i]);
sort(div.begin(),div.end(),greater<ll>());
map<ll,int,greater<ll>> cnt;
For(j,1,n) ++cnt[__gcd(a[j],a[i])];
for(auto x:pf) for(ll y:div) if(a[i]%(y*x.first)==0) cnt[y]+=cnt[y*x.first];
for(auto x:cnt){
if(ans>x.first) break;
if(x.second>=(n+1)/2){
ans=max(ans,x.first);break;
}
}
}
cout<<ans<<'\n';
#ifdef zyz
Debug("Elapsed time: %dms\n",int(clock()));
#endif
return 0;
}//16767234565894488865
1651D - Nearest Excluded Points | 599A - Patrick and Shopping |
237A - Free Cash | 1615B - And It's Non-Zero |
1619E - MEX and Increments | 34B - Sale |
1436A - Reorder | 1363C - Game On Leaves |
1373C - Pluses and Minuses | 1173B - Nauuo and Chess |
318B - Strings of Power | 1625A - Ancient Civilization |
864A - Fair Game | 1663B - Mike's Sequence |
448A - Rewards | 1622A - Construct a Rectangle |
1620A - Equal or Not Equal | 1517A - Sum of 2050 |
620A - Professor GukiZ's Robot | 1342A - Road To Zero |
1520A - Do Not Be Distracted | 352A - Jeff and Digits |
1327A - Sum of Odd Integers | 1276A - As Simple as One and Two |
812C - Sagheer and Nubian Market | 272A - Dima and Friends |
1352C - K-th Not Divisible by n | 545C - Woodcutters |
1528B - Kavi on Pairing Duty | 339B - Xenia and Ringroad |